home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 15 / Amiga Plus Leser CD 15.iso / Tools / Development / yacas_alg / yacas_morphos / share / yacas / include / lispplugin.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-13  |  1.9 KB  |  61 lines

  1.  
  2. /** \file lispplugin.h defines the api the plugin should provide.
  3.  * It is a pure abstract class that needs to be rederived for each
  4.  * platform the core needs to run on. If no dynamic loaded libraries
  5.  * are supported on the platform, you can use LispDllBase as the default
  6.  * DLL loader. Its basic behaviour is to fail and return NULL pointers.
  7.  * The choice of which LispDllBase-derived class to use is made in
  8.  * the lisptype.h file.
  9.  *
  10.  * Yacas has a module 'cstubgen' that can generate the plugin glue
  11.  * code between an external library and yacas. See the manual for more
  12.  * details.
  13.  */
  14.  
  15. #ifndef __lispplugin_h__
  16. #define __lispplugin_h__
  17.  
  18. /** The class that resides on the loaders side. This class
  19.  *  is responsible for obtaining a LispPluginBase-derived
  20.  *  class from a dll, and unloading the dll when necessary.
  21.  *
  22.  */
  23. #include "yacasbase.h"
  24.  
  25. class LispPluginBase : public YacasBase
  26. {
  27. public:
  28.     /**
  29.      *  The Add method receives a LispEnvironment as argument, and
  30.      *  can modify this environment accordingly. Things it can do is
  31.      *  add new function calls defined in the plugin, define global
  32.      *  variables (constants for the plugin).
  33.      */
  34.     virtual void Add(LispEnvironment& aEnvironment) = 0;
  35.     virtual void Remove(LispEnvironment& aEnvironment) = 0;
  36.     virtual ~LispPluginBase(){};
  37. };
  38.  
  39. /** \class LispDllBase defines the features a class that can load a dll
  40.  *  needs to have. If it fails to open or get a plugin it should return
  41.  *  a NULL pointer. The destructor should close the DLL again.
  42.  */
  43. class LispDllBase : public YacasBase
  44. {
  45. public:
  46.     LispDllBase();
  47.     virtual LispInt Open(LispCharPtr aDllFile,LispEnvironment& aEnvironment);
  48.     virtual LispInt Close(LispEnvironment& aEnvironment);
  49.     LispPluginBase* Plugin(void);
  50.     virtual ~LispDllBase();
  51.     LispCharPtr DllFileName() const;
  52. protected:
  53.     virtual LispPluginBase* GetPlugin(void);
  54. protected:
  55.     LispPluginBase* iPlugin;
  56.     LispString iDllFileName;
  57. };
  58.  
  59. #endif
  60.  
  61.